<template>
    <transition name="slide">
        <music-list :title="title" :bg-image="bgImage" :songList="songlist"></music-list>
    </transition>
</template>

<script>
    import MusicList from '../music-list/music-list'
    import {mapGetters} from 'vuex'
    export default {
        name:"disc",
        computed: {
            ...mapGetters([
                'disc',
                "recommend"
            ]),
            mid(){
                return this.recommend.id
            },
            title() {
            //歌手名称
            return this.recommend.title;
            },
            bgImage() {
                //歌曲图片
                return this.recommend.cover;
            },
        },
        data() {
            return {
                songlist: []
            }
        },
        methods: {
            getDetail(mid){
                this.$axios.post(`http://localhost:1111/api/getRecommendDetailData/${mid}`,mid)
                .then(res=>{
                    // console.log(res.data.songlist)
                    this.songlist=res.data.songlist
                    console.log(res)
                })
            }
            
        },
        created() {
            this.getDetail(this.mid)
            // this.songlist=this.disc.songlist;
            // eslint-disable-next-line no-console
            // console.log(this.songlist);
        },
        components: {
            MusicList
        }
    }
</script>

<style scoped lang="stylus" rel="stylesheet/stylus">
    .slide-enter-active, .slide-leave-active
        transition: all 0.3s

    .slide-enter, .slide-leave-to
        transform: translate3d(100%, 0, 0)
</style>